<?php
@include('include/common.inc.php');	
@include('logincleck.php');	
if($_SESSION['Admin']!='')
{
	echo '<script language="javascript">';   	
	echo "window.location.href='adminlist.php';";
	echo '</script>';
}
if($_POST['Submit']!='')
{
	$admin_name = trim($_POST['username']);
	$admin_pass = md5(trim($_POST['password']));	
	$sel = "select * from $TBL_ADMIN where mem_id='$admin_name' and password='$admin_pass'";
	$res = mysql_query($sel);
	if($row = @mysql_fetch_array($res))
	{
		MyNotice("succeed!", 2, "adminlist.php");
		$_SESSION['Admin'] = $admin_name;
		setcookie("CookieAdmin", $admin_name, time()+2592000); /* 有效期 1个月 */ 
		exit();
	}else{
		MyNotice("error!", 1, "adminlist.php");
		exit();
	}	
}	
$smarty->assign("CookieAdmin",$_COOKIE['CookieAdmin']);	
$smarty->assign("page_string",$page_string);
@include('number.php');//验证码
$smarty->display('admin.html');
?>